%% -*- coding: utf-8 -*-
%%   yatce
%%   Copyright (C) 2009   UENISHI Kota <kuenishi+yatce@gmail.com>
%%
%%     This program is free software: you can redistribute it and/or modify
%%     it under the terms of the GNU Lesser General Public License as published by
%%     the Free Software Foundation, either version 3 of the License, or
%%     (at your option) any later version.
%%
%%     This program is distributed in the hope that it will be useful,
%%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%     GNU Lesser General Public License for more details.
%%
%%     You should have received a copy of the GNU Lesser General Public License
%%     along with this program.  If not, see <http://www.gnu.org/licenses/>.

-module(c_SUITE).
-author('kuenishi@gmail.com').

-compile(export_all).

%% just calling yatce_map.c: easy test

-include("ct.hrl").

init_per_suite(Config) ->
    {ok, _Pid} = yatce:start([{libdir, "../../../c_src/"}]),
    Config.

end_per_suite(Config) ->
    yatce:stop(),
    Config.

all() -> [ dup_init, tch %, tcb, tct, '*', '+' 
	  ].

dup_init(Config)->
    {ok, _Pid} = yatce:start([{libdir, "../../../c_src/"}]),
    Config.

tch(Config)->    
    T = yatce:newdb('/tmp/test.tch', []), 
    {ok, opened} = T:open(),
    {ok, closed} = T:close(),
    {ok, all_passed} = yatce:test(),
    Config.

tcb(Config)->    
    T = yatce:newdb('/tmp/test.tcb', []), 
    {ok, opened} = T:open(),
    {ok, closed} = T:close(),
    {ok, all_passed} = yatce:test(),
    Config.

tct(Config)->    
    T = yatce:newdb('/tmp/test.tct', []), 
    {ok, opened} = T:open(),
    {ok, closed} = T:close(),
    {ok, all_passed} = yatce:test(),
    Config.

'*'(Config)->    
    T = yatce:newdb('*', []), 
    {ok, opened} = T:open(),
    {ok, closed} = T:close(),
    {ok, all_passed} = yatce:test(),
    Config.

'+'(Config)->    
    T = yatce:newdb('+', []), 
    {ok, opened} = T:open(),
    {ok, closed} = T:close(),
    {ok, all_passed} = yatce:test(),
    Config.
